package Text_007;

import java.util.Scanner;

public class Login {

	public static void main(String[] args) {
		//已知正确用户名和密码，实现模拟用户登录。
		Scanner sca = new Scanner(System.in);
		
		String usename1 = "张三";
		String possword1 = "223344";
		//登陆次数
		int count = 0;
		while(count<3) {
			System.out.println("请输入用户名：");
			String usename = sca.next();
			System.out.println("请输入密码：");
			String possword = sca.next();	
			if (usename.equals(usename1)&&possword.equals(possword1)){
				System.out.println("登录成功");
				return;
			}
			else {
				if(count==2) {
					System.out.println("登录失败");
					return;
				}else {
					System.out.println("登录失败，请重新登陆，还有"+(2-count)+"次机会");
				}
				count++;
			}
				
		}
	}

}
